<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html class="">
<head>
	
	<meta name="author" content="蓝凌科技">
	<meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
	<meta http-equiv="Pragma" content="no-cache" />
	<meta http-equiv="Expires" content="0" />

	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm.min.css">	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/sm-extend.min.css">	
	
	<title>帮工小哥</title>
	
	<script type="text/javascript">
	    var _root = '<?php echo ($_site_url); echo U(' / ');?>', _controller = '<?php echo ($_controller); ?>';
	</script>
	
	
	<link rel="stylesheet" type="text/css" href="/Public/Api/css/order.css">


</head>
<body>
	
	

<div class="page-group">
    <div class="page page-current my-order">
    	
    	<?php switch($orderModel["status"]): case "1": ?><div class="bar bar-standard bar-footer order-foot">
		            <div class="content-block order-foot-block button-two">
		                <div class="row">
		                    <div class="col-50">
		                    	<a href="#" onclick="cancel('<?php echo ($orderModel['order_id']); ?>')" 
		                    		class="button button-big button-fill button-apply">申请退单</a>
		                    </div>
		                    <div class="col-50">
		                    	<a href="tel:4008526519" class="button button-big button-fill button-contact">联系客服</a>
		                    </div>
		                </div>
		            </div>
		        </div><?php break;?>
    		<?php case "2": ?><div class="bar bar-standard bar-footer order-foot">
		            <div class="content-block order-foot-block button-two">
		                <div class="row">
		                    <div class="col-50">
		                    	<a href="tel:<?php echo ((isset($workerModel['account']) && ($workerModel['account'] !== ""))?($workerModel['account']):'4008526519'); ?>" 
		                    		class="button button-big button-fill button-apply">申请退单</a>
		                    </div>
		                    <div class="col-50">
		                    	<a href="tel:4008526519" class="button button-big button-fill button-contact">联系客服</a>
		                    </div>
		                </div>
		            </div>
		        </div><?php break;?>
    		<?php case "3": ?><div class="bar bar-standard bar-footer order-foot">
		            <div class="content-block order-foot-block button-two">
		                <div class="row">
		                    <div class="col-50"><a href="#" class="button button-big button-fill disabled">申请退单</a></div>
		                    <div class="col-50"><a href="tel:4008526519" class="button button-big button-fill button-contact">联系客服</a></div>
		                </div>
		            </div>
		        </div><?php break;?>
    		<?php case "4": ?><div class="order-foot bar bar-standard bar-footer">
		            <div class="content-block order-foot-block">
		                <div class="row">
		                    <div class="col-100">
		                    	<a href="<?php echo U('WeChatApi/jsApiCall', 'order_id='.$orderModel['order_id']);?>" data-no-cache="true"
		                    			class="button button-big button-fill button-pay">支付</a>
		                    </div>
		                </div>
		            </div>
		        </div><?php break; endswitch;?>
        
        <div class="content">
        	<?php if(empty($workerModel)): ?><div class="top">
	                <div class="container">暂无接单</div>
	            </div>
	        <?php else: ?>
	        	<div class="order-detail-top" 
	        		onclick="javascript:window.location.href='<?php echo U('Worker/viewAction', 'worker_id='.$workerModel['worker_id']);?>'">
	                <div class="list-block media-list">
	                    <ul>
	                        <li class="order-p">
	                            <div class="item-content">
	                                <div class="item-media">
	                                    <img src="<?php echo ((isset($workerModel['fullpath']) && ($workerModel['fullpath'] !== ""))?($workerModel['fullpath']):'/Public/Api/images/person1.png'); ?>" alt="">
	                                </div>
	                                <div class="item-inner">
	                                    <div class="item-title-row">
	                                        <div class="item-title"><?php echo ($workerModel['name']); ?> <?php echo ($workerModel['account']); ?>
	                                        	<span class="order-num"><?php echo ($workerModel['orders_sum']); ?> 单</span>
	                                        </div>
	                                    </div>
	                                    <div class="item-subtitle">
	                                    	<?php $__FOR_START_1531767887__=0;$__FOR_END_1531767887__=5;for($i=$__FOR_START_1531767887__;$i < $__FOR_END_1531767887__;$i+=1){ if($workerModel['score']/2 > $i): ?><img src="/Public/Api/images/taoxin.png"><?php endif; } ?>
	                                    </div>
	                                    <div class="item-subtitle">工号：<?php echo ($workerModel['eid']); ?></div>
	                                </div>
	                            </div>
	                        </li>
	                    </ul>
	                </div>
	            </div><?php endif; ?>
            <div class="order-details">
                <p class="order-title">订单详情</p>
                <ul class="order-details-list">
                    <li><span>订单编号：</span><span><?php echo ($orderModel['order_no']); ?></span></li>
                    <li><span>下单时间：</span><span><?php echo (GetDateTimeMk($orderModel['create_time'])); ?></span></li>
                    <li><span>检测部位：</span><span><?php echo ($orderModel['detail_name']); ?></span></li>
                    <li>
                    	<span>预约时间：</span>
                    	<span>
                    		<?php if($orderModel["emergency"] == '2'): echo ((isset($orderModel['delay']) && ($orderModel['delay'] !== ""))?($orderModel['delay']):'50'); ?>分钟
                    		<?php else: ?>
                    			<?php echo (GetDateTimeMk($orderModel['appointment'])); endif; ?>
                    	</span>
                    </li>
                    <li>
                    	<span class="contacts">联系人：</span><span><?php echo ($orderModel['contact']); ?></span>
                    </li>
                    <li><span>联系电话：</span><span><?php echo ($orderModel['telphone']); ?></span></li>
                    <li><span>地　　址：</span><span><?php echo ($orderModel['address']); echo ($orderModel['name']); ?></span></li>
                    <li class="clearfix remark">
                        <span class="left">备　　注：</span>
                        <span class="left"><?php echo ($orderModel['remark']); ?></span>
                    </li>
                </ul>
            </div>
            <div class="order-details">
            	<p class="order-title">维修部位图片</p>
            	<div class="server-list clearfix">
                <ul class="order-details-list">
                	<?php if(!empty($list)): if(is_array($list)): foreach($list as $key=>$record): ?><li>
		                        <img src="<?php echo ($record); ?>"/>
		                    </li><?php endforeach; endif; endif; ?>
                </ul>
                </div>
            </div>
        </div>
    </div>
</div>




	<!-- 底部
================================================== -->
<footer>
</footer>
<script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "", //当前网站地址
            "APP"    : "/api.php?s=", //当前项目地址
            "PUBLIC" : "/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    
</script>
<script src="/Public/Api/js/zepto.min.js" type="text/javascript">
</script>
<script type="text/javascript">
//坑死人的配置项
//若不加此配置，则所有页面均使用 js 和 css 缓存
$.config = {
   	router: false
}
</script>
<script src="/Public/Api/js/sm.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/sm-extend.min.js" type="text/javascript">
</script>
<script src="/Public/Api/js/think.js" type="text/javascript">
</script>


<script type="text/javascript">

function cancel(orderID){
	
	if(!isNaN(orderID)){
		
		$.prompt('退单申请说明', function (value) {
			
			var target = Think.U('Orders/cancel');
			$.post(target, {'order_id':orderID, 'reason':value}, function(data){
				if(data.status == '0'){
					$.confirm('参数错误，请刷新后重试', function () {
				    	window.location.reload();
			      	});
				}else if(data.status == '-201'){
					$.confirm('身份认证已失效，请重新登录', function () {
				        var loginURL = Think.U('Public/login');
				        window.location.href = loginURL;
				        return false;
				    });
				}else if(data.status == '1'){
					$.toast('您已退单成功', 1000);
					window.location.href = Think.U('Orders/index');
				}
			});
		});
	}
}

</script>

<!-- 用于加载js代码 -->

</body>
</html>